<?php declare(strict_types=1);


namespace app\model;

class AuthGroupAccess extends Base {

    protected $name = 'group_rule_access';

    // 设置字段信息
    protected $schema = [
        'id'=>'int',
        'rule_id'=>'int',
        'group_id'=>'int',
        'create_at' => 'datetime',
        'update_at' => 'datetime',
        'delete_at' => 'datetime',
    ];

    // Get Rights ID
    public function getRightsIDs(array  $groupIDs): array {
        $result = $this->whereIn('group_id',$groupIDs)->column('rule_id');
        return $result;
    }
    // Del
    public function del(int $groupId): bool {
        $list = $this->where('group_id','=',$groupId)->select();
        $result = $list->delete();
        return $result >=0 ? true : false;
    }

}

 
